// dlg.txt

begintalkscript;

variables;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(14,2) == 0;
	question = "special";
	text1 = "You enter the farmland south of the city of Mera. The fields are hemmed in by constantly advancing thickets of evergreen trees. Everything grows quickly. Most of the flora here has been at least slightly touched by the art of the Shapers.";
	text2 = "You don't see any of the people you would normally expect to. No serviles tending the fields, no woodsmen harvesting the trees. What you see instead are the tracks of roamers crisscrossing the path.";
	text3 = "There must be an infestation of rogues here, and Mera hasn't been able to spare the soldiers to hunt them down yet. You can sense them lurking in the shadows, watching for a moment of vulnerability so they can mob you.";
	action = SET_SDF 14 2 1;

begintalknode 2;
	state = -1;
	nextstate = -1;
	condition = get_sdf(14,4) == 0;
	question = "special";
	text1 = "This was a woodsman's hut. It's empty now, and there are worrying signs of a fight. The gnawed bones and bloodstains in the bedroom testify to how it turned out.";
	text2 = "As you explore, you hear snarls coming from the woods outside. The roamer who found such easy prey here seems to have stayed in the area.";
	action = SET_SDF 14 4 1;
	code =
		activate_hidden_group(1);
	break;
	
begintalknode 3;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You see a group of people running across the fields toward you. Well, not you. The gate of Mera behind you. You're just in the way.";
	text2 = "It is a band of refugees. They are filthy and exhausted. They look like they have been traveling through the woods for a long time. A few have old, battered weapons.";
	text3 = "Behind them are several roamers, chasing them on the final approach to the safety of the city. Their fangs are bared, and they are catching up.";
	
begintalknode 4;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You try to speak with the exhausted refugees, but they are mostly concerned with entering the city before they collapse.";

begintalknode 5; // craft book
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "You find the remnants of someone's old research lab notebook. It was heavily damaged in an explosion, probably the final event in an exciting alchemical career. One less-charred section is of interest:";
	text2 = "_When you bind the gemstone with the length of wood, this is the moment to infuse the materials with the power. This step must always be done on the anvil. Fortunately, I have had access to the one under Helft._";
	text3 = "_I have had luck drawing the energy from roamer fangs or artila eyes. The power in the eyes is more unstable, but mixing the eye goo with chopped saltweed seems to stabilize it._";
	text4 = "_Some have criticized me for the volatile nature of my experiments. Such timidity. With my care and skill, there is no way that there can be a_";
	text5 = "The rest of the page has been burned away.";


begintalknode 10;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The sign says:";
	text2 = "  Mera - North";
	text3 = "  Great Burwood Swamp - East";
	text4 = "  Mera Fens - West";
	text5 = "  Kaz - South";

begintalknode 11;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The sign says:";
	text2 = "  STOLLEN'S JUNK SHOP";
	text3 = "  CLOSED FOR GOOD!";
	
begintalknode 12;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "The sign says:";
	text2 = "  Mera Fens - West";
	text3 = "  Beware! Unbound!";

begintalknode 13;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "__";

begintalknode 14;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "__";

begintalknode 15;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "special";
	text1 = "__";
	
//

begintalknode 30;
	state = -1;
	nextstate = 30;
	condition = 1;
	question = "Stollen";
	text1 = "You enter this old junk shop. Piles of old, rusty, and dented items line the walls. You see a surprising number of Shaper tools.";
	text2 = "In the shadows, a pile of rags starts to move. As you reach for your blade, the figure shouts at you. _We're closed! Didn't you see the sign? Closed! We're not opening again until we're rid of the roamers._";
	text3 = "An irritated old man hobbles into the light and looks at you. _Oh. You aren't a ... I mean, you might have money. Well, while you're here, I can sell you something._";
	text5 = "Stollen grumbles, _Can't we hurry this up? I need to be closing everything up. All my goods are packed up and ready to go._ He points at the two lockboxes in the middle of the room. _I'm only talking to you as a favor._";
	action = INTRO;

begintalknode 31;
	state = 30;
	nextstate = 31;
	condition = 1;
	question = "Tell me about your shop.";
	text1 = "_We're closing! Didn't you hear? Your ears are as bad as mine._";
	text2 = "_I'm just trying to get a few extra coins out of my stock. That's why I'm talking to you at all._";
	text3 = "As he talks, you notice that he occasionally looks at the locked doors to the north and south. He seems nervous.";
	code =
		if (gf(14,7) > 0)
			rs(3);
	break;
	
begintalknode 32;
	state = 31;
	nextstate = -1;
	condition = 1;
	question = "Why are you closing?";
	text1 = "_The roamers! Astoria kept sending soldiers out to kill them. They kept coming back. Then she gave up._";
	text2 = "_Don't know what she is waiting for. Not like she'll just make peace with the rebels and get them to take the rogues away. Right?_";

begintalknode 33;
	state = 31;
	nextstate = -1;
	condition = 1;
	question = "You seem to have a lot of Shaper tools.";
	text1 = "He suddenly gets very defensive. _I just buy junk. Then sell it. I don't know where it's from. I don't know what it's for. Not my business._";
	text2 = "He's not telling the truth, of course. You suspect that he has made a good living ferrying old, worn out Shaper tools to people who aren't supposed to have them.";

begintalknode 34;
	state = 31;
	nextstate = 32;
	condition = gf(14,7) == 0;
	question = "What's behind those two doors?";
	text1 = "_What doors? I don't see any doors. What? Where? Oh. Those doors. Yes, I suppose those are doors._";
	text2 = "_Can't remember what's behind them. Too much trouble to figure out how to open them. You should just forget about them._";

begintalknode 35;
	state = 32;
	nextstate = -1;
	condition = gf(14,7) == 0 && get_stat(20) < 4;
	question = "Can you try to open them for me?";
	text1 = "You try to convince him to open the doors. No luck. Whatever is back there, he's definitely nervous about owning it.";

begintalknode 36;
	state = 32;
	nextstate = -1;
	condition = gf(14,7) == 0 && get_stat(20) >= 4;
	question = "Perhaps I could pay you to open the doors? What I find there will be just between you and me.";
	text1 = "You try to convince him to open the doors. With care, you get his greed to overcome his caution.";
	text2 = "_Well, I suppose I might be able to open them. For a price. Four hundred coins. Per door. No less. And I don't know how what got back there got back there. No idea._";
	code =
		sf(14,7,1);
		award_party_xp(100,4);
	break;
	
begintalknode 37;
	state = 30;
	nextstate = -1;
	condition = gf(14,7) > 0 && gf(14,8) == 0;
	question = "Please open the north door. (Pay 400 coins.)";
	text1 = "You don't have enough money. Stollen is annoyed.";
	text2 = "You pay Stollen the money. His memory has a sudden, miraculous recovery. _Oh, yes!_ He jabs a loose bit of masonry by the door with his finger.";
	text3 = "_Don't know how I forgot about that. Good luck in there. No idea what's there._";
	code =
		if (coins_amount() < 400) {
			rs(2); rs(3);
			}
			else {
				rs(1);
				change_coins(-400);
				sf(14,8,1);
				}
	break;
	
				
begintalknode 38;
	state = 30;
	nextstate = -1;
	condition = gf(14,7) > 0 && gf(14,9) == 0;
	question = "Please open the south door. (Pay 400 coins.)";
	text1 = "You don't have enough money. Stollen is annoyed.";
	text2 = "You pay Stollen the money. His memory has a sudden, miraculous recovery. _Oh, yes!_ He jabs a loose bit of masonry by the door with his finger.";
	text3 = "_Don't know how I forgot about that. Good luck in there. No idea what's there._";
	code =
		if (coins_amount() < 400) {
			rs(2); rs(3);
			}
			else {
				rs(1);
				change_coins(-400);
				sf(14,9,1);
				}
	break;

begintalknode 39;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "Let me see what you have for sale.";
	text1 = "You conclude your business.";	
	code = 
		begin_shop_mode("Stollen's Junk",
		  "You inspect Stollen's junk. It is rare, unusual, exotic junk. But junk.",
		  21,4,0);	
	break;


begintalknode 40;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "I would like to sell something.";
	text1 = "You conclude your business.";	
	code = 
		begin_sell_mode();
	break;


begintalknode 41;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "That is all I need.";
	text1 = "_Good. Go away. We're closed._";
	action = END_TALK;
	
	
//

begintalknode 50;
	state = -1;
	nextstate = 50;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode 51;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

	
begintalknode 52;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 53;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 54;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 55;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 56;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 57;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
	
begintalknode 58;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 59;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 60;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 61;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 62;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 63;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

begintalknode 64;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

//

begintalknode 70;
	state = -1;
	nextstate = 70;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode 71;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

//

begintalknode 90;
	state = -1;
	nextstate = 90;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode 91;
	state = 90;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
		